package main

import (
	"fmt"
	"image"
	"image/color"
	"image/png"
	"math"
	"os"
)

const (
	size = 128
)

func main() {
	rec := image.Rect(0, 0, 2*size, 2*size)
	image := image.NewRGBA(rec)
	c := color.RGBA{0xff, 0, 0, 0xff}
	for x := 0; x < 2*size; x++ {
		for y := 0; y < 2*size; y++ {
			image.Set(x, y, color.RGBA{0xee, 0xee, 0xee, 0xff})
		}
	}
	for t := 0.0; t < 2*math.Pi; t += 0.001 {
		x := int(2.0*size*t/(2.0*math.Pi) + 0.5)
		y := int(size + 100*math.Sin(t) + 0.5)
		image.Set(x, 2*size-y, c)
	}

	err := png.Encode(os.Stdout, image)
	if err != nil {
		fmt.Fprintf(os.Stderr, "%v\n", err)
	}
}
